#include <stdio.h>
#include "../../liboctopus/src/octopus.h"


#define PIN 9

int
main ()
{

  struct octopus_context octopus;

  octopus_init (&octopus);
  octopus_open (&octopus);
  octopus_pwm_init (&octopus, PIN);
  octopus_pwm_speed (&octopus, PIN, 1);

  int up = 1, i = 0, j;

  for (j = 0; j < 500; j++)
    {
      if (up == 1)
	i++;
      else
	i--;

      octopus_pwm_value (&octopus, PIN, (unsigned char) i);

      if (i >= 255)
	up = 0;

      if (i == 0)
	up = 1;
    }
  octopus_pwm_value (&octopus, PIN, 1);
  octopus_pwm_deinit (&octopus, PIN);


  char desc[64];
  octopus_get_hwdesc (&octopus, desc);
  printf ("Device: %s\n", desc);

  octopus_close (&octopus);



  return 0;


}
